/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#pragma once


#include <vulkan/vulkan.h>
#include "../../帧缓存.h"

using namespace std;

/*typedef struct {
	VkImage		m_Image;
	VkImageView	m_View;

	VkFormat	m_颜色图像格式;

}S_交换面缓存;*/



struct S_VkImage : public S_纹理 {
	VkImage			m_Image;
	VkDeviceMemory	m_Mem;
	VkImageView		m_View;
	VkImageLayout	m_布局;
	
	VkDescriptorImageInfo	m_着色器参数;

	S_VkImage() {
		m_着色器参数 = {};
		m_布局 = {};
		m_Image = {};
		m_View = {};
		m_Mem = {};
	}
	~S_VkImage() {}

} ;




struct S_交换链支持信息 {
	VkSurfaceCapabilitiesKHR        capabilities;
	std::vector<VkSurfaceFormatKHR> formats;
	std::vector<VkPresentModeKHR>   presentModes;
};




struct S_Vk逻辑设备 {
	VkDevice	m_Device;
	uint32		m_图形_列队家族ID;
	uint32		m_交换链_列队家族ID;

	VkSwapchainKHR			m_交换链;
	VkExtent2D				m_视口大小;

	vector<VkCommandPool>			m_命令缓存池;
	//vector<S_交换面缓存>	m_交换面颜色缓存;
	//vector<S_交换面缓存>	m_交换面深度缓存;

	vector<VkCommandBuffer>			m_命令缓存;
	vector<VkDescriptorSetLayout>	desc_layout;
	vector<S_帧缓存*>				m_交换链帧缓存;
	VkRenderPass					m_渲染过程;
	VkSemaphore						m_图像信号量;
	VkSemaphore						m_渲染刷新信号量;

	VkQueue							m_图形列队;
	VkQueue							m_交换列队;




	S_Vk逻辑设备();
	~S_Vk逻辑设备();

};



typedef struct {
	VkPhysicalDeviceMemoryProperties	m_内存属性;
	VkPhysicalDeviceProperties			m_设备属性;
}S_Vk物理设备属性;



//typedef struct {
//	bool				支持光追;
//}S_VK物理设备属性;



struct QueueFamilyIndices {
	int graphicsFamily = -1;
	int presentFamily = -1;

	bool isComplete() { return graphicsFamily >= 0 && presentFamily >= 0; }
};



